<template>
  <div class>
     <el-table :data="tableData" border style="width: 100%">
          <el-table-column  align="center" width="30">
            <template slot="header">
             <el-button class="el-icon-circle-plus"
              style="padding:0"
              type="text" @click.prevent="addRow()"></el-button>
            </template>
            <template slot-scope="scope">
              <el-button type="text"
              style="padding:0"
              class="el-icon-remove"
              @click="handleDelete(scope.$index, scope.row)"></el-button>
          </template>
          </el-table-column>
          <el-table-column
            type="index"
            width="50" label="序号">
          </el-table-column>
          <el-table-column label="资质名称" align="center" min-width="300">
            <template slot-scope="scope">
              <el-input v-model="scope.row.quaName" size="mini"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="发证机关" align="center" min-width="300">
            <template slot-scope="scope">
              <el-input v-model="scope.row.issueOrgan" size="mini"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="发证日期" align="center" min-width="200">
            <template slot-scope="scope">
              <el-date-picker type="date" placeholder="选择日期"  size="mini" v-model="scope.row.issueDate" style="width: 100%;" :editable="false"></el-date-picker>
            </template>
          </el-table-column>
          <el-table-column label="有效期限" align="center" min-width="120">
            <template slot-scope="scope">
              <el-input v-model="scope.row.effectiveTerm" size="mini"></el-input>
            </template>
          </el-table-column>

          <el-table-column label="备注" align="center" min-width="300">
            <template slot-scope="scope">
              <el-input v-model="scope.row.remark" size="mini"></el-input>
            </template>
          </el-table-column>
        </el-table>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
     tableData: []
    };
  },
  computed: {},
  mounted() {
 
  },
  methods: {
    getData(entId){
      this.$api.formPost( '/api/biz/entQualification/doGetList',{
        entId
      }).then(res => {
        console.log(res)
            if(res.retHead.code=="0000000"){
                this.tableData = res.retBody.list;
            }else{
                this.$message({
                    type: 'error',
                    message: res.retHead.message
                });
            }
        });
    },
    doSave(id,path,name) {
      let that = this;
      return new Promise((resolve, reject) => {
        that.$api
          .post("/api/biz/entQualification/doSubmit", { qyzzList: that.tableData,entId:id,applicationPath:path,componentName:name})
          .then(res => {
            if (res.retHead.code == "0000000") {
              // that.$message.success(res.retHead.message);
              resolve(res.retBody);
            } else {
              that.$message.error(res.retHead.message);
            }
          });
      });
    },
    // 增加行
    addRow() {
      var list = {
      }
      this.tableData.unshift(list)
    },
    handleDelete(index, row) {
        this.tableData.splice(index, 1);
      }

  },
  created() {}
};
</script>
<style lang='scss' scoped>

</style>